﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Domzs.Extensions
{
    public static class StringExtensions
    {
        /// <summary>
        /// Determines whether [is null or empty] [the specified value].
        /// </summary>
        /// <param name="value">The value.</param>
        /// <returns>
        ///     <c>true</c> if [is null or empty] [the specified value]; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsNullOrEmpty(this string value)
        {
            return string.IsNullOrEmpty(value);
        }

        /// <summary>
        /// Formats the with.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <param name="args">The args.</param>
        /// <returns></returns>
        public static string FormatWith(this string value, params object[] args)
        {
            return string.Format(null, value, args);
        }

        //public static string FormatWith(this string value, params object[] args)
        //{
        //    return string.Format(null, value, args);
        //}

        //public static bool IsNullOrEmpty(this string value)
        //{
        //    return string.IsNullOrEmpty(value);
        //}

        public static string ShortFormNameOfDayNumbers(this string value)
        {
            if (string.IsNullOrEmpty(value))
            {
                return "";
            }
            StringBuilder builder = new StringBuilder();
            foreach (string str in value.Split(new char[] { ',' }))
            {
                builder.Append(string.Format("{0:ddd},", str));
            }
            return builder.ToString();
        }
    }
}
